package logger

import (
	"runtime"
	"time"
	"fmt"
	"os"
)

func Fatal(args ...interface{}) {
	_, file, line, _ := runtime.Caller(1)
	fmt.Println(fmt.Sprintf("[FATAL] %s 文件: %s 行数: %d 异常: ",
		time.Now().Format("2006-01-02 15:04:05"),
		file,
		line,
	) + fmt.Sprintln(args...))
	os.Exit(2)
}

func Error(args ...interface{}) {
	_, file, line, _ := runtime.Caller(1)
	fmt.Println(fmt.Sprintf("[ERROR] %s 文件: %s 行数: %d 异常: ",
		time.Now().Format("2006-01-02 15:04:05"),
		file,
		line,
	) + fmt.Sprintln(args...))
}

func Warn(args ...interface{}) {
	_, file, line, _ := runtime.Caller(1)
	fmt.Println(fmt.Sprintf("[WARN] %s 文件: %s 行数: %d 警告: ",
		time.Now().Format("2006-01-02 15:04:05"),
		file,
		line,
	) + fmt.Sprintln(args...))
}

func Info(args ...interface{}) {
	_, file, line, _ := runtime.Caller(1)
	fmt.Println(fmt.Sprintf("[INFO] %s 文件: %s 行数: %d 信息: ",
		time.Now().Format("2006-01-02 15:04:05"),
		file,
		line,
	) + fmt.Sprintln(args...))
}





